package nine;

import java.util.Scanner;

public class Jiu {
    //行越界列正常为情况1；
    //行正常列越界为情况2；
    //行列都正常为有为3无为4；
    //行列都不正常为5
    static Scanner sc=new Scanner(System.in);
    static int n=sc.nextInt();
    static int N=10000;
    static int[][] arr1=new int[N][N];
    static int l=1;
    static int x1=0;
    static int y1=(n-1)/2;

    public static void main(String[] args) {
arr1[x1][y1]=1;
        int[][] arr = new int[n][n];
        arr[x1][y1]=1;
        for (int p = 0; p < n*n-1; p++) {
            panduan(x1,y1);
            add(arr);
        }
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.printf(arr[i][j] + " ");
            }
            System.out.println();
        }
    }
    static int  panduan_1(int sum){
        int count=0;
        if(sum<n&&sum>=0){
            count=1;
        }
        return count;
    }

    static void panduan(int x,int y) {
        //x<3&&x>0,y<3&&y>0
        if (panduan_1(x - 1) == 0 && panduan_1(y + 1) == 1) {
            x1=n-1;
            y1=y+1;
        } else if (panduan_1(x - 1) == 1 && panduan_1(y + 1) == 0) {
            x1=x-1;
            y1=0;
        } else if (panduan_1(x - 1) == 0 && panduan_1(y + 1) == 0) {
            x1=x+1;
        } else if (panduan_1(x - 1) == 1 && panduan_1(y + 1) == 1){
            if (arr1[x - 1][y + 1] == 1) {
                x1=x+1;
            } else {
                x1=x-1;
                y1=y+1;
            }
        }
    }

    static void add(int[][] arr){
       arr[x1][y1]=++l;
       arr1[x1][y1]=1;
    }
}
